import { Component, OnInit } from '@angular/core';
import { InterfaceService } from 'src/app/services/interface.service';
import { Router } from '@angular/router';


@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
 data:any={
   name:'15501625757',
   password:'123456'
 };
  constructor(public ds: InterfaceService,private router:Router) { }

  ngOnInit() {
  }

   //登录
   btnLogin():void{
    this.ds.getLogin(this.data.name,this.data.password).subscribe((res:any)=>{
      if(res.code==100){
        sessionStorage.setItem('USER',JSON.stringify(res.data));
        this.router.navigateByUrl('index');
      }
    });
  }

  
}
